package com.inspur.gs.sbssdl.sbwhgl.sbrh.sbrh.back.sbsssbrhjh.determinations;
import com.inspur.edp.bef.api.lcp.IStandardLcp;
import com.inspur.edp.bef.core.LcpUtil;
import com.inspur.edp.cef.api.message.*;
import com.inspur.edp.bef.api.action.determination.*;
import com.inspur.edp.bef.spi.action.determination.*;
import com.inspur.edp.cef.entity.changeset.*;
import com.inspur.edp.bef.spi.action.determination.AbstractDetermination;
import com.inspur.edp.bef.api.action.determination.IDeterminationContext;
import com.inspur.edp.cef.entity.entity.IEntityData;
import com.inspur.edp.bef.api.action.determination.IBeforeRetrieveDtmContext;
import com.inspur.edp.cef.entity.entity.IValuesContainer;

public class sbssSbrhJhItemDeletingDtms1MgrAction extends AbstractB4SaveDetermination {
	public sbssSbrhJhItemDeletingDtms1MgrAction(IDeterminationContext context, IChangeDetail change) {
		super(context,change);
	}
	private String sbtzCfg = "com.inspur.gs.sbssdl.sbssgl.sbtz.sbtz.back.SbssSbtz";
	@Override
	public  void execute() {
		// 将设备润滑配置还原
		IEntityData data = getOrgData();
		if (data == null || getOrgData().getValue("dev") == null){
			return;
		}

		IStandardLcp lcp = LcpUtil.getLcp(sbtzCfg);
		IValuesContainer dev = (IValuesContainer) getOrgData().getValue("dev");
		if (dev.getValue("dev") == null){
			return;
		}

		String devId = dev.getValue("dev").toString();
		ModifyChangeDetail modify = new ModifyChangeDetail(devId);
		modify.putItem("rhp", false);

		lcp.modify(modify);
		lcp.save();
	}
	private IEntityData getOrgData() {
		return (IEntityData)super.getContext().getOriginalData();
	}
}